package com.lcredu.web;

import com.lcredu.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 黎长容
 * @date 2025-07-22 14:42
 */
@Controller
@RequestMapping("/login")
public class LoginHandler {

    @RequestMapping("/doLogin")
    public String doLogin(User user) {
        System.out.println(user);
        if (!("lcr".equals(user.getUsername()) && "123456".equals(user.getPassword()))) {
            return "forward:/error.jsp";
        }
        return "forward:/WEB-INF/pages/login_ok.jsp";
    }
    
    
    @RequestMapping("/returnLogin")
    public String returnLogin(){
        System.out.println("fail...");
        return "redirect:login.jsp";
    }
}
